<include file="public@head" />
</head>

<body>
    <div class="layui-fluid wrap js-check-wrap" id="component-tabs">
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">URL美化</div>
                    <div class="layui-card-body">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li class="layui-this"><a href="{:url('route/index')}">URL美化</a></li>
                                <li><a href="{:url('route/add')}">添加URL规则</a></li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <form class="js-ajax-form layui-form" action="{:url('route/listOrder')}" method="post">
                                        <div class="table-actions">
                                            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm js-ajax-submit">排序</button>
                                        </div>
                                        <table class="layui-table">
                                            <thead>
                                                <tr>
                                                    <th width="50">排序</th>
                                                    <th width="50">ID</th>
                                                    <th>原始网址</th>
                                                    <th>显示网址</th>
                                                    <th>类型</th>
                                                    <th>状态</th>
                                                    <th width="130">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <php>
                                                    $statuses=array('0'=>"已禁用","1"=>"已启用");
                                                    $types=array('1'=>"自定义","2"=>"别名定义");
                                                </php>
                                                <foreach name="routes" item="vo">
                                                    <tr>
                                                        <td>
                                                            <eq name="vo.type" value="2">
                                                                <input style="width:50px;" type="text" value="{$vo.list_order}">
                                                                <else />
                                                                <input style="width:50px;" name="list_orders[{$vo.id}]" type="text" value="{$vo.list_order}">
                                                            </eq>
                                                        </td>
                                                        <td>{$vo.id}</td>
                                                        <td>{$vo.full_url}</td>
                                                        <td>{$vo.url}</td>
                                                        <td>
                                                            <eq name="vo.type" value="2">
                                                                <span class="layui-btn layui-btn-danger layui-btn-xs" data-toggle="tooltip" title="别名定义规则,无法编辑,排序">{$types[$vo['type']]}</span>
                                                                <else />
                                                                <span class="layui-btn layui-btn-success layui-btn-xs" data-toggle="tooltip" title="自定义规则,可以编辑,排序">{$types[$vo['type']]}</span>
                                                            </eq>
                                                        </td>
                                                        <td><span class="layui-btn layui-btn-xs layui-btn-warm">{$statuses[$vo['status']]}</span></td>
                                                        <td>
                                                            <span class="layui-btn-group">
                                                                <eq name="vo.type" value="2">
                                                                    <span class="layui-btn-xs layui-btn layui-disabled">编辑</span>
                                                                    <span class="layui-btn-xs layui-btn layui-disabled">禁用</span>
                                                                    <span class="layui-btn-xs layui-btn layui-disabled">删除</span>
                                                                    <else />
                                                                    <a class="layui-btn-xs layui-btn layui-btn-normal" href="{:url('route/edit',array('id'=>$vo['id']))}">编辑</a>
                                                                    <eq name="vo.status" value="1">
                                                                        <a class="layui-btn layui-btn-xs layui-btn-warm js-ajax-dialog-btn" href="{:url('route/ban',array('id'=>$vo['id']))}" data-msg="确定禁用吗？">禁用</a>
                                                                        <else />
                                                                        <a href="{:url('route/open',array('id'=>$vo['id']))}" class="layui-btn layui-btn-xs layui-btn-normal js-ajax-dialog-btn" data-msg="确定启用吗？">启用</a>
                                                                    </eq>
                                                                    <a class="layui-btn layui-btn-xs layui-btn-danger js-ajax-delete" href="{:url('route/delete',array('id'=>$vo['id']))}">删除</a>
                                                                </eq>
                                                            </span>
                                                        </td>
                                                    </tr>
                                                </foreach>
                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <th width="50">排序</th>
                                                    <th width="50">ID</th>
                                                    <th>原始网址</th>
                                                    <th>显示网址</th>
                                                    <th>类型</th>
                                                    <th>状态</th>
                                                    <th width="130">操作</th>
                                                </tr>
                                            </tfoot>
                                        </table>
                                        <div class="table-actions">
                                            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm js-ajax-submit">排序</button>
                                        </div>
                                    </form>
                                </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <include file="public@footer" />
</body>

</html>